Filter host libstdc++ ABI flag in rustc_llvm cross builds#158808
Merged
rust-bors[bot] merged 1 commit intoJul 21, 2026
Conversation
Collaborator
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @cuviper (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 21, 2026
Rollup of 14 pull requests Successful merges: - #159307 (Improve cross-namespace name diagnostics) - #159543 (Remove extra semicolons in parsing item lists) - #157270 (ergonomic_clones_dotuse_capture_by_ref: Capture upvar by ref for `.use` in non-move closures) - #158496 (Move `check_rustc_pub_transparent` into the attribute parser) - #158547 (Move `std::io::buffered` to `alloc::io`) - #158808 (Filter host libstdc++ ABI flag in rustc_llvm cross builds) - #159362 (Add regression test for #120328) - #159472 (Support creating float constants in rustc_public mir) - #159505 (make rustdoc::bare_urls strip trailing periods from url) - #159568 (Suggest close compiler options) - #159578 (Extract coroutine closure helper functions) - #159601 (Make `TokenTreeCursor` private) - #159613 (Set the rustc lib path for unstable-book-gen) - #159616 (Clarify the comment about stage1/stage2 discrepancy in input-stats test)
rust-timer
added a commit
that referenced
this pull request
Jul 21, 2026
Rollup merge of #158808 - chitao1234:fix-rustc-llvm-cross-libstdcxx-abi, r=cuviper Filter host libstdc++ ABI flag in rustc_llvm cross builds `compiler/rustc_llvm/build.rs` invokes `llvm-config` for the build host machine in cross compilation scenarios. In particular, the normal LLVM configuration on Linux sets `_GLIBCXX_USE_CXX11_ABI=1` and those flags would then pollute C++ wrapper objects being compiled for the target. This patch makes `rustc_llvm` avoid propagating that macro when cross-compiling. This follows the existing pattern in `rustc_llvm/build.rs`, which already treats parts of cross `llvm-config` output as host-specific by filtering `-m*` flags and rewriting include paths. Although I think the more appropriate approach is to use a separate target LLVM C++ flags setting. This currently affects Haiku rustc cross-compilation from Linux hosts. The Haiku target currently uses the old libstdc++ string ABI by default and that creates an ABI mismatch. I currently work around this locally by setting environment variable `CXXFLAGS_x86_64_unknown_haiku=-D_GLIBCXX_USE_CXX11_ABI=0`.
pull Bot
pushed a commit
to xtqqczze/rust-lang-miri
that referenced
this pull request
Jul 22, 2026
Rollup of 14 pull requests Successful merges: - rust-lang/rust#159307 (Improve cross-namespace name diagnostics) - rust-lang/rust#159543 (Remove extra semicolons in parsing item lists) - rust-lang/rust#157270 (ergonomic_clones_dotuse_capture_by_ref: Capture upvar by ref for `.use` in non-move closures) - rust-lang/rust#158496 (Move `check_rustc_pub_transparent` into the attribute parser) - rust-lang/rust#158547 (Move `std::io::buffered` to `alloc::io`) - rust-lang/rust#158808 (Filter host libstdc++ ABI flag in rustc_llvm cross builds) - rust-lang/rust#159362 (Add regression test for rust-lang/rust#120328) - rust-lang/rust#159472 (Support creating float constants in rustc_public mir) - rust-lang/rust#159505 (make rustdoc::bare_urls strip trailing periods from url) - rust-lang/rust#159568 (Suggest close compiler options) - rust-lang/rust#159578 (Extract coroutine closure helper functions) - rust-lang/rust#159601 (Make `TokenTreeCursor` private) - rust-lang/rust#159613 (Set the rustc lib path for unstable-book-gen) - rust-lang/rust#159616 (Clarify the comment about stage1/stage2 discrepancy in input-stats test)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
compiler/rustc_llvm/build.rsinvokesllvm-configfor the build host machine in cross compilation scenarios. In particular, the normal LLVM configuration on Linux sets_GLIBCXX_USE_CXX11_ABI=1and those flags would then pollute C++ wrapper objects being compiled for the target.This patch makes
rustc_llvmavoid propagating that macro when cross-compiling. This follows the existing pattern inrustc_llvm/build.rs, which already treats parts of crossllvm-configoutput as host-specific by filtering-m*flags and rewriting include paths. Although I think the more appropriate approach is to use a separate target LLVM C++ flags setting.This currently affects Haiku rustc cross-compilation from Linux hosts. The Haiku target currently uses the old libstdc++ string ABI by default and that creates an ABI mismatch. I currently work around this locally by setting environment variable
CXXFLAGS_x86_64_unknown_haiku=-D_GLIBCXX_USE_CXX11_ABI=0.